﻿<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>MooTools Demos - Chaining</title>
	<link type="text/css" rel="Stylesheet" href="native.css" />
</head>
<body>

<p><a id="link" href="#">Execute Example</a></p>

<div id="elements">
	<div class="element"></div>
	<div class="element"></div>
	<div class="element otherElement"></div>
	<div class="element otherElement"></div>
</div>

<h3>Code:</h3>
<pre>Elements.implement({

	equalize: function(property){
		var sum = 0, i, len;
		len = i = this.length;
		while (i--) sum += this[i].getDimensions()[property];
		var average = Math.round(sum / len);
		i = len;
		while (i--) this.tween(property, average);
		return this;
	},

	setRandom: function(property, min, max){
		var i = this.length, value;
		while (i--){
			value = Math.round(min + (max - min) * Math.random());
			this[i].tween(property, value);
		}
		return this;
	}

});</pre>

<h3>Usage:</h3>
<pre>myElements.equalize(property);
myElements.setRandom(property, min, max);</pre>

	<script type="text/javascript" charset="utf-8" src="../../src/loader.js"></script>
	<script type="text/javascript">		HmJS.$JSManager.$basepath = '../../src/';</script>
	<script type="text/javascript" charset="utf-8" src="../../src/demo/action/moo/native.js"></script>
</body>
</html>
